/**
 * Lenovo Group
 * Copyright (c) 1999-2016 All Rights Reserved.
 */
package com.lenovo.lmrp.api.appgateway;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.container.AsyncResponse;
import javax.ws.rs.container.Suspended;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import com.lenovo.lmrp.api.model.RestResponse;
import com.lenovo.lmrp.api.model.view.AttachmentUploadVO;
import com.lenovo.lmrp.api.model.view.ChangedTicketVO;
import com.lenovo.lmrp.api.model.view.SearchListFilter;
import com.lenovo.lmrp.api.model.view.TicketTotalVO;
import com.lenovo.lmrp.api.model.view.TicketVO;

/**
 * 
 * @author wujin
 * @version v1.0
 */
public interface IAppTicket {
    
    @POST
    @Path("/{itsmcode}/tickets")
    public RestResponse<List<TicketVO>> getTicketList(@PathParam("itsmcode") String itsmcode,
                                                    SearchListFilter filter);
    
    @GET
    @Path("/{itsmcode}/tickets/{ticketid}")
    public RestResponse<TicketVO> getTicket(@PathParam("itsmcode") String itsmcode,
                                            @PathParam("ticketid") String ticketid);
    
    @GET
    @Path("/{itsmcode}/tickets/total")
    public RestResponse<TicketTotalVO> getTicketTotal(@PathParam("itsmcode") String itsmcode);
    
    /**
     * 查询工程师抢单是否成功
     * @param itsmcode
     * @param ticketid
     * @return
     */
    @GET
    @Path("/{itsmcode}/tickets/grab/result/{ticketid}")
    public RestResponse<Object> getGrabResult(@PathParam("itsmcode") String itsmcode,
                                             @PathParam("ticketid") String ticketid);
    
    @PUT
    @Path("/{itsmcode}/tickets/{ticketid}/{action}")
    public RestResponse<String> updateTicket(@PathParam("itsmcode") String itsmcode,
                                              @PathParam("ticketid") String ticketid,
                                              @PathParam("action") String action,
                                              ChangedTicketVO ticket);
    
    @POST
    @Path("/{itsmcode}/tickets/{ticketid}/attachments/info")
    public RestResponse<List<String>> createAttachment(@PathParam("itsmcode") String itsmcode,
                                                   @PathParam("ticketid") String ticketid,
                                                   AttachmentUploadVO attachmentUploadVO);
    
    @POST
    @Path("/{itsmcode}/tickets/{ticketid}/attachments/{attachmentid}")
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    public void uploadAttachment(@PathParam("itsmcode") String itsmcode,
                               @PathParam("ticketid") String ticketid,
                               @PathParam("attachmentid") String attachmentid,
                               @Context HttpServletRequest request,
                               @Suspended AsyncResponse asyncResponse);



}
